<?php
class Groups_m extends MY_Model{
	
	function __construct(){
		parent::__construct();
		$this->_table = 'ser_groups';
	}
	
	function get_all($param = array()){
		if(!empty($param['not_name'])){
			$this->db->where_not_in('name',$param['not_name']);
		}
		return parent::get_all();
	}
	
	public function  insert($data){
		$data['group_by'] = $this->current_user->group_id;
		return parent::insert($data);
	}
	//lay array id cap tren array(1,2,3,4);
	public function group_parent($group_by){
		$result = array();
		//$result = array($group_by);
		$this->db->where('id',$group_by);
		$row = $this->db->get($this->_table)->row();
		if(count($row)>0){
			$result[] = $row->name;
			$this->group_parent($row->group_by);
		}
		return $result;
	}
	
	
}